//app.js wx6a469e0c3ae3236e
App({
  onLaunch: function() {
    // 展示本地存储能力
    var logs = wx.getStorageSync('logs') || []
    logs.unshift(Date.now())
    wx.setStorageSync('logs', logs)
    // 获取手机系统信息
    wx.getSystemInfo({
      success: res => {
        //导航高度
        this.globalData.navHeight = res.statusBarHeight + 46;			
      },
      fail(err) {
        console.log(err);
      }
    })

    // 自动登录方法
    wx.login({
      success: res => {
        wx.request({
          url: 'https://api.xzs51.com/v1/register/register',
          method: 'post',
          header: {
            'content-type': 'application/x-www-form-urlencoded' // 默认值
          },
          data: {
            code: res.code
          },
          success: e => {
						//登录成功 本地缓存中指定的 成功key  ACCESSTOKEN 
            if (e.data.status == 'succeed') {
						//	console.log(e.data.data.token)
              wx.setStorageSync('ACCESSTOKEN', e.data.data.token)
              if(this.userInfoReadyCallback){
                 this.userInfoReadyCallback(res)
              }
            }
          }
        })
      }
    })
  },
  globalData: {
    userInfo: null,
    navHeight: 0,
    backPath: '',
    ajaxIndex: false,
    type:1
  }
})